import { defHttp } from '@/utils/http/axios';
import { RequestEnum } from '@/enums/httpEnum';
import { ServicePrefixEnum } from '@/enums/commonEnum';
import type { AxiosRequestConfig } from 'axios';

const MODULAR = 'test';

export const Api = {
  TestGet: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/get`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  TestPost: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/post`,
    method: RequestEnum.POST,
  } as AxiosRequestConfig,
  TestGet4Path: (name: string) => {
    return {
      url: `${ServicePrefixEnum.BASE}/${MODULAR}/get/${name}`,
      method: RequestEnum.GET,
    } as AxiosRequestConfig;
  },
}


export const testGet = (params) => {
  return defHttp.request({ ...Api.TestGet, params })
}


export const testPost = (params) => {
  return defHttp.request({ ...Api.TestPost, params })
}

export const testGet4Path = (name: string = "alex") =>
    defHttp.request({ ...Api.TestGet4Path(name) })


